//SamXIAO
#include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926
#define   SQUARE(x) ((x)*(x))
//double SQUARE(double x) { return x*x;}

int f[10086];

void w1()
{
	int a, b, c,  n, L, m, ans = 0;
	scanf("%d", &n);
	int mi=99999, ma=-9999999;
	for(int i=0; i<n; i++){
		scanf("%d", f+i);
		if(f[i] > ma) ma = f[i];
  }
	for(int i=0; i<n; i++){
		if(f[i] != ma) ans += f[i];
  }

	printf("%d", ans);
}

int main()
{
	w1();
  return 0;
}
